import unittest

from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QCoreApplication
from FlowControl.UIFlowControl import UILightBox

class TestUILightBox(unittest.TestCase):
    def setUp(self):
        self.app = QApplication([])
        self.light_box = UILightBox()

    def test_init(self):
        self.assertIsInstance(self.light_box, UILightBox)

    def test_setup_ui(self):
        self.assertIsInstance(self.light_box.flight, QtWidgets.QLineEdit)
        self.assertIsInstance(self.light_box.sobt, QtWidgets.QLineEdit)
        self.assertIsInstance(self.light_box.DEPAP, QtWidgets.QLineEdit)
        self.assertIsInstance(self.light_box.ARRAP, QtWidgets.QLineEdit)
        self.assertIsInstance(self.light_box.flowButton, QtWidgets.QPushButton)

    def test_open_flow_control_window(self):
        self.light_box.flowButton.clicked.emit()
        self.assertIsInstance(self.light_box.flowWindow, QtWidgets.QWidget)

    def tearDown(self):
        self.app.quit()

if __name__ == '__main__':
    unittest.main()